<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateIndicatorsDailySummaryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('indicators_daily_summary', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('agent_id')->index()->comment('用户 ID');
            $table->tinyInteger('type')->comment('用户维度; 1:代理商 2:团队 3:合伙人');

            $table->date('day')->index()->comment('某年某月某日');
            $table->unsignedBigInteger('performance_summary')->default(0)->comment('业绩汇总 单位分');
            $table->unsignedBigInteger('order_summary')->default(0)->comment('订单汇总');
            $table->unsignedBigInteger('commission_summary')->default(0)->comment('佣金汇总 单位分');
            $table->unsignedBigInteger('reward_summary')->default(0)->comment('奖励汇总 单位分');
            $table->unsignedBigInteger('income_summary')->default(0)->comment('收入汇总 单位分');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('indicators_daily_summary');
    }
}
